<template>
	<view class="content">
		<view class="post">
			<uni-section title="我的收藏" type="line">
					<template v-for="item in postsList" :key="item.id">
						<PostItem :post="item" />
					</template>
			</uni-section>
		</view>
		<van-empty description="暂无收藏" v-if="!postsList.length" />
	</view>
	
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { onMounted } from 'vue'

import PostItem from '@/components/post-item/post-item.vue'
import usePostStore from '@/store/post.js'

const postStore = usePostStore()
const { postsList } = storeToRefs(postStore)
onMounted(() => {
	postStore.queryMyCollectionAction()
})
</script>

<style lang="less" scoped>
.post {
	padding: 0 10rpx;
	.post-content {
		background-color: #F5F6F8;
	}
}
.loading {
	position: absolute;
	top: 60%;
	left: 50%;
	transform: translate(-50%, -50%);
}
</style>
